#!/bin/env python
# -*- coding:utf-8
"""
@author:xingz
@file:demo.py
@time:2022/05/19
"""
from tkinter import *
from tkinter.ttk import *

component_lst = ("ocnSR_RR0_RR2_20220519005105", "ocnIC_CC0_20220519005105", "ocnG_G_CM_XNM0_XNM14_CM_XNM2_XNM5_XNM6_IT_XNM0XI0__20220519005105")


def select_component_to_routing():
    win = Toplevel()
    win.title = "routing manager"
    frame = Frame(win)
    frame.grid(sticky=W)
    Label(frame, text='External Pin Direction').grid(row=0, column=0)
    external_pin_dirt_var = StringVar()
    external_pin_dirt_combox = Combobox(frame, value=("N", "S", "E", "W"), textvariable=external_pin_dirt_var, width=5)
    external_pin_dirt_combox.grid(row=0, column=1, sticky=W)

    frame2 = Frame(win)
    frame2.grid(row=1, column=0)

    frame20 = Frame(frame2)
    frame20.grid(row=0, column=0)
    tree = Treeview(frame20, column=("component", "external_pin_direction"), show='headings')
    tree.heading('component', text='component')
    tree.heading('external_pin_direction', text='External Pin Direction')
    tree.grid(row=1, column=0)
    for component in component_lst:
        tree.insert("", 0, values=(component, ""))

    info_frame = Frame(frame2)
    info_frame.grid(row=0, column=1, sticky=NW)
    Label(info_frame, text="Component name").grid(row=0, column=0)
    info_component_name_label = Label(info_frame, text="")
    info_component_name_label.grid(row=0, column=1)

    mainloop()


if __name__ == '__main__':
    select_component_to_routing()
